package controller

import (
	"github.com/gin-gonic/gin"
	"go_web_learn/common"
	"net/http"
)

type BaseController struct{}

func (base BaseController) success(c *gin.Context, data interface{}) {
	result := common.Result{
		Code:    10000,
		Message: "success",
		TraceNo: common.GetTraceNo(c),
		Data:    data,
	}
	c.JSON(http.StatusOK, result)
}

func (base BaseController) fail(c *gin.Context, data interface{}) {
	result := common.Result{
		Code:    99999,
		Message: "success",
		TraceNo: common.GetTraceNo(c),
		Data:    data,
	}
	c.JSON(http.StatusOK, result)
}
